/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package service.impl;

import java.util.List;
import service.IImageService;
import pojo.Image;

/**
 *
 * @author Cong
 */
public class ImageServiceImpl<T extends Image> extends ServiceImpl<T>
		implements IImageService<T> {

	public T findImageByID(Integer ID) {

		List<T> image = this.getDao().createQuery(
				" select i from Image i "
						+ " where i.imageID = :ID ")
				.setParameter("ID", ID).list();

		if (image.size() > 0)
			return image.get(0);

		return null;
	}

        public void createImage(T image)
        {
            this.getDao().create(image);
        }
}
